/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.octgame.octantis;

import de.matthiasmann.twl.ProgressBar;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;
import org.octgame.resources.twl.BasicTWLGameState;
import org.octgame.resources.twl.RootPane;

/**
 *
 * @author Hempa
 */
public class InitializeState extends BasicTWLGameState {

    private int stateID = -1;
    private ProgressBar initBar;
    private RootPane rootPane;

    @Override
    public int getID() {
        return this.stateID;
    }

    public InitializeState(int id) {
        this.stateID = id;
    }

    public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
        rootPane = super.getRootPane();


    }

    public void render(GameContainer gc, StateBasedGame sbg, Graphics grphcs) throws SlickException {
        
    }

    public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
        Input i = gc.getInput();
        i.enableKeyRepeat();
        
        if (i.isKeyPressed(Input.KEY_LEFT))
        {
            initBar.setValue(initBar.getValue() - 0.05f);
        } else if (i.isKeyPressed(Input.KEY_RIGHT))
        {
            initBar.setValue(initBar.getValue() + 0.05f);
        } else if (i.isKeyPressed(Input.KEY_ESCAPE))
        {
            sbg.enterState(OctGame.MENUSTATE);
        }
    }

    @Override
    protected void layoutRootPane()
    {
        if (initBar != null) {
            initBar.setPosition(0,0);
        }
    }

}
